package com.example.mobile2021606129ly0330;

import android.os.Bundle;
import android.view.View;
import android.app.Activity;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;

import androidx.appcompat.app.AppCompatActivity;

public class MainActivity_easy extends AppCompatActivity {


    private Button butRes;
    private EditText edIntA;
    private EditText edIntB;
    private TextView textRes;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main_easy);

        initView();
        butRes.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                int a = Integer.parseInt(edIntA.getText().toString());
                int b = Integer.parseInt(edIntB.getText().toString());
                int c = a + b;
                textRes.setText(c);
            }
        });

    }

    private void initView() {
        edIntA = (EditText) findViewById(R.id.ed_int_a);
        edIntB = (EditText) findViewById(R.id.ed_int_b);
        textRes = (TextView) findViewById(R.id.text_res);
        butRes = (Button) findViewById(R.id.but_res);

    }
}




